// 简化C接口，隐藏复杂的内存管理
typedef void* CArray;
typedef void* CMatrix;
typedef void* CImage;

// 简化API
CArray carray_create(size_t size);
void carray_free(CArray arr);
void carray_append(CArray arr, int32_t value);
int32_t carray_get(CArray arr, size_t index);

CMatrix cmatrix_create(size_t rows, size_t cols);
void cmatrix_free(CMatrix mat);
CMatrix cmatrix_multiply(CMatrix a, CMatrix b, int* error);

CImage cimage_create(size_t width, size_t height, int channels);
void cimage_free(CImage img);
CImage cimage_grayscale(CImage img, int* error);